#include <iostream>
#include "defer.h"
#include <gtest/gtest.h>

TEST(DEFER, defer_test01) {
    std::cout << "func1 enter" << std::endl;
    minic::Defer d([]{
        std::cout << "defer" << std::endl;
    });
    std::cout << "func1 exit" << std::endl;
}

TEST(DEFER, defer_test02) {
    std::cout << "func2 enter" << std::endl;
    int a = 10;
    minic::Defer([a]{
        std::cout << "defer:" << a << std::endl;
    });

    std::cout << "func2 exit" << std::endl;
}